Skip to content

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Jun 4, 2025

Currently we create a placeholder element to indicate where an item will be dropped. The placeholder gets moved around between drop containers as the user is dragging. In some cases this might not be desirable, because the data representing the dragged item might be copied, rather than moved.

These changes address this use case by adding the cdkDropListHasAnchor input. When enabled, it'll tell the drop list to leave an anchor element, representing the dragged item, inside the original list. The anchor differs from the placeholder in that it will stay in the original container and won't move to any subsequent containers.

Fixes #13906.

Currently we create a placeholder element to indicate where an item will be dropped. The placeholder gets moved around between drop containers as the user is dragging. In some cases this might not be desirable, because the data representing the dragged item might be copied, rather than moved.

These changes address this use case by adding the `cdkDropListHasAnchor` input. When enabled, it'll tell the drop list to leave an anchor element, representing the dragged item, inside the original list. The anchor differs from the placeholder in that it will stay in the original container and won't move to any subsequent containers.

Fixes angular#13906.
@crisbeto crisbeto requested a review from andrewseguin June 4, 2025 07:53
@crisbeto crisbeto requested a review from a team as a code owner June 4, 2025 07:53
@crisbeto crisbeto requested review from mmalerba and removed request for a team June 4, 2025 07:53
@crisbeto crisbeto added the target: minor This PR is targeted for the next minor release label Jun 4, 2025
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: cdk/drag-drop labels Jun 4, 2025
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Jun 4, 2025
@crisbeto crisbeto merged commit f446d7c into angular:main Jun 4, 2025
30 of 32 checks passed
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: cdk/drag-drop detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support copying items from source container

2 participants